﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;

namespace DAL
{
    class JctDormsInitializer : DropCreateDatabaseIfModelChanges<Jct_Dorms_DB>
    {
        protected override void Seed(Jct_Dorms_DB context)
        {
            base.Seed(context);
            InitializeCities(context);
            InitializeProfessions(context);
            InitializePrograms(context);
            InitializeDorms(context);
            InitializeRooms(context);
            InitializeCharges(context);
            InitializeStudents(context);
            InitializeUsers(context);
        }

        private void InitializeCities(Jct_Dorms_DB context)
        {
            context.Cities.Add(new BE.Model.City() { Name = "Afula" });
            context.Cities.Add(new BE.Model.City() { Name = "Arad" });
            context.Cities.Add(new BE.Model.City() { Name = "Ariel" });
            context.Cities.Add(new BE.Model.City() { Name = "Ashdod" });
            context.Cities.Add(new BE.Model.City() { Name = "Ashkelon" });
            context.Cities.Add(new BE.Model.City() { Name = "Bat Yam" });
            context.Cities.Add(new BE.Model.City() { Name = "Beersheba" });
            context.Cities.Add(new BE.Model.City() { Name = "Beit Shemesh" });
            context.Cities.Add(new BE.Model.City() { Name = "Beitar Illit" });
            context.Cities.Add(new BE.Model.City() { Name = "Bnei Brak" });
            context.Cities.Add(new BE.Model.City() { Name = "Dimona" });
            context.Cities.Add(new BE.Model.City() { Name = "Eilat" });
            context.Cities.Add(new BE.Model.City() { Name = "Elad" });
            context.Cities.Add(new BE.Model.City() { Name = "Givat Shmuel" });
            context.Cities.Add(new BE.Model.City() { Name = "Givatayim" });
            context.Cities.Add(new BE.Model.City() { Name = "Hadera" });
            context.Cities.Add(new BE.Model.City() { Name = "Haifa" });
            context.Cities.Add(new BE.Model.City() { Name = "Herzliya" });
            context.Cities.Add(new BE.Model.City() { Name = "Holon" });
            context.Cities.Add(new BE.Model.City() { Name = "Jerusalem" });
            context.Cities.Add(new BE.Model.City() { Name = "Karmiel" });
            context.Cities.Add(new BE.Model.City() { Name = "Kiryat Ata" });
            context.Cities.Add(new BE.Model.City() { Name = "Kiryat Bialik" });
            context.Cities.Add(new BE.Model.City() { Name = "Karmiel" });
            context.Cities.Add(new BE.Model.City() { Name = "Kiryat Gat" });
            context.Cities.Add(new BE.Model.City() { Name = "Kiryat Malakhi" });
            context.Cities.Add(new BE.Model.City() { Name = "Kiryat Motzkin" });
            context.Cities.Add(new BE.Model.City() { Name = "Kiryat Motzkin" });
            context.Cities.Add(new BE.Model.City() { Name = "Kiryat Ono" });
            context.Cities.Add(new BE.Model.City() { Name = "Kiryat Shmona" });
            context.Cities.Add(new BE.Model.City() { Name = "Kiryat Yam" });
            context.Cities.Add(new BE.Model.City() { Name = "Kfar Saba" });
            context.Cities.Add(new BE.Model.City() { Name = "Lod" });
            context.Cities.Add(new BE.Model.City() { Name = "Maale Adumim" });
            context.Cities.Add(new BE.Model.City() { Name = "Maalot-Tarshiha" });
            context.Cities.Add(new BE.Model.City() { Name = "Migdal HaEmek" });
            context.Cities.Add(new BE.Model.City() { Name = "Modiin-Maccabim-Reut" });
            context.Cities.Add(new BE.Model.City() { Name = "Modiin Illit" });
            context.Cities.Add(new BE.Model.City() { Name = "Nahariya" });
            context.Cities.Add(new BE.Model.City() { Name = "Nazareth Illit" });
            context.Cities.Add(new BE.Model.City() { Name = "Nesher" });
            context.Cities.Add(new BE.Model.City() { Name = "Ness Ziona" });
            context.Cities.Add(new BE.Model.City() { Name = "Netanya" });
            context.Cities.Add(new BE.Model.City() { Name = "Netivot" });
            context.Cities.Add(new BE.Model.City() { Name = "Ofakim" });
            context.Cities.Add(new BE.Model.City() { Name = "Or Akiva" });
            context.Cities.Add(new BE.Model.City() { Name = "Or Yehuda" });
            context.Cities.Add(new BE.Model.City() { Name = "Petah Tikva" });
            context.Cities.Add(new BE.Model.City() { Name = "Raanana" });
            context.Cities.Add(new BE.Model.City() { Name = "Ramat Gan" });
            context.Cities.Add(new BE.Model.City() { Name = "Ramat HaSharon" });
            context.Cities.Add(new BE.Model.City() { Name = "Ramla" });
            context.Cities.Add(new BE.Model.City() { Name = "Rehovot" });
            context.Cities.Add(new BE.Model.City() { Name = "Rishon LeZion" });
            context.Cities.Add(new BE.Model.City() { Name = "Rosh HaAyin" });
            context.Cities.Add(new BE.Model.City() { Name = "Safed" });
            context.Cities.Add(new BE.Model.City() { Name = "Sderot" });
            context.Cities.Add(new BE.Model.City() { Name = "Tel Aviv-Yaffo" });
            context.Cities.Add(new BE.Model.City() { Name = "Tiberias" });
            context.Cities.Add(new BE.Model.City() { Name = "Tirat Carmel" });
            context.Cities.Add(new BE.Model.City() { Name = "Yavne" });
            context.Cities.Add(new BE.Model.City() { Name = "Yehud-Monosson" });
            context.Cities.Add(new BE.Model.City() { Name = "Yokneam" });
        }

        private void InitializeProfessions(Jct_Dorms_DB context)
        {
            context.Professions.Add(new BE.Model.Profession() { Name = "Software Engeneering" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Electronics" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Pre-academic" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Marketing Tcnology" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Accounting" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Management Information Systems" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Industrial Engineering and managed" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Accounting" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Optoelectronics Engineering" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Management and Marketing" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Physics" });
            context.Professions.Add(new BE.Model.Profession() { Name = "Computer Science" });
        }

        private void InitializePrograms(Jct_Dorms_DB context)
        {
            context.Programs.Add(new BE.Model.Program() { Name = "Machon Lev" });
            context.Programs.Add(new BE.Model.Program() { Name = "Machon Nave" });
            context.Programs.Add(new BE.Model.Program() { Name = "Americans" });
            context.Programs.Add(new BE.Model.Program() { Name = "Pre-Academic" });
            context.Programs.Add(new BE.Model.Program() { Name = "Ofek" });
            context.Programs.Add(new BE.Model.Program() { Name = "Immigrants" });
            context.Programs.Add(new BE.Model.Program() { Name = "Atuda" });
            context.Programs.Add(new BE.Model.Program() { Name = "Atuda Haredit" });
            context.Programs.Add(new BE.Model.Program() { Name = "Yeshiva Tihonit" });
            context.Programs.Add(new BE.Model.Program() { Name = "Shenat Mesima" });
            context.Programs.Add(new BE.Model.Program() { Name = "Bareket" });
        }

        private void InitializeDorms(Jct_Dorms_DB context)
        {
            context.Dorms.Add(new BE.Model.Dorm() { Name = "Beren", NumberOfFloors = 4 });
            context.Dorms.Add(new BE.Model.Dorm() { Name = "Amaragi", NumberOfFloors = 4 });
            context.Dorms.Add(new BE.Model.Dorm() { Name = "Glikman", NumberOfFloors = 4 });
            context.Dorms.Add(new BE.Model.Dorm() { Name = "Rotstein", NumberOfFloors = 4 });
        }

        private void InitializeRooms(Jct_Dorms_DB context)
        {
            context.Rooms.Add(new BE.Model.Room()
            {
                DormID = 1,
                Dorm = context.Dorms.Find(1),
                ChargeID = 5,
                Charge = context.Charges.Find(5),
                Floor = 2,
                Number = "201",
                NumberOfBeds = 3
            });
            context.Rooms.Add(new BE.Model.Room()
            {
                DormID = 2,
                Dorm = context.Dorms.Find(2),
                ChargeID = 4,
                Charge = context.Charges.Find(4),
                Floor = 2,
                Number = "205",
                NumberOfBeds = 3
            });
            context.Rooms.Add(new BE.Model.Room()
            {
                DormID = 3,
                Dorm = context.Dorms.Find(3),
                ChargeID = 6,
                Charge = context.Charges.Find(6),
                Floor = 3,
                Number = "303",
                NumberOfBeds = 3
            });
            context.Rooms.Add(new BE.Model.Room()
            {
                DormID = 3,
                Dorm = context.Dorms.Find(3),
                ChargeID = 5,
                Charge = context.Charges.Find(5),
                Floor = 1,
                Number = "111",
                NumberOfBeds = 3
            });

            context.Rooms.Add(new BE.Model.Room()
            {
                DormID = 3,
                Dorm = context.Dorms.Find(3),
                ChargeID = 4,
                Charge = context.Charges.Find(4),
                Floor = 1,
                Number = "101",
                NumberOfBeds = 2
            });

            context.Rooms.Add(new BE.Model.Room()
            {
                DormID = 1,
                Dorm = context.Dorms.Find(1),
                ChargeID = 5,
                Charge = context.Charges.Find(5),
                Floor = 2,
                Number = "221",
                NumberOfBeds = 3
            });
        }

        private void InitializeCharges(Jct_Dorms_DB context)
        {
            context.Charges.Add(new BE.Model.Charge() { Name = "3 in room, Apartment", Code = "13", Amount = 6100 });
            context.Charges.Add(new BE.Model.Charge() { Name = "2 in room, Apartment", Code = "14", Amount = 7300 });
            context.Charges.Add(new BE.Model.Charge() { Name = "3 in big room", Code = "18", Amount = 7100 });
            context.Charges.Add(new BE.Model.Charge() { Name = "2 in small room", Code = "19", Amount = 6300 });
            context.Charges.Add(new BE.Model.Charge() { Name = "3 in room", Code = "20", Amount = 6650 });
            context.Charges.Add(new BE.Model.Charge() { Name = "2 in room", Code = "21", Amount = 7600 });
            context.Charges.Add(new BE.Model.Charge() { Name = "2 in small room (with balcony)", Code = "68", Amount = 6900 });
            context.Charges.Add(new BE.Model.Charge() { Name = "2 in room, Beren", Code = "68", Amount = 7850 });
            context.Charges.Add(new BE.Model.Charge() { Name = "3 in small room, Apartment", Code = "92", Amount = 5900 });
            context.Charges.Add(new BE.Model.Charge() { Name = "4 in big room, Apartment", Code = "116", Amount = 5900 });
            context.Charges.Add(new BE.Model.Charge() { Name = "2 in small room (with balcony)", Code = "117", Amount = 5600 });
            context.Charges.Add(new BE.Model.Charge() { Name = "2 in room, Gross", Code = "117", Amount = 5600 });
            context.Charges.Add(new BE.Model.Charge() { Name = "3 in room, Gross", Code = "117", Amount = 5600 });
            context.Charges.Add(new BE.Model.Charge() { Name = "Apartment, Gross", Code = "117", Amount = 5600 });
            context.Charges.Add(new BE.Model.Charge() { Name = "10 in apartment", Code = "117", Amount = 5600 });
            context.Charges.Add(new BE.Model.Charge() { Name = "Custom charge", Code = "850", Amount = 0 });
        }

        private void InitializeStudents(Jct_Dorms_DB context)
        {
            context.Students.Add(new BE.Model.Student()
            {
                FirstName = "Elad",
                LastName = "Yehiel",
                Email = "elad55@gmail.com",
                ProfessionID = 4,
                Profession = context.Professions.Find(4),
                CityID = 23,
                City = context.Cities.Find(3),
                ProgramID = 6,
                Program = context.Programs.Find(4),
                Comments = "Gever Gever"
            });

            context.Students.Add(new BE.Model.Student()
            {
                FirstName = "oren",
                LastName = "abramov",
                Email = "bubu@gmail.com",
                ProfessionID = 3,
                Profession = context.Professions.Find(3),
                CityID = 23,
                City = context.Cities.Find(23),
                ProgramID = 1,
                Program = context.Programs.Find(1),
                Comments = "chabadnik mukzan"
            });

            context.Students.Add(new BE.Model.Student()
            {
                FirstName = "Aviram",
                LastName = "Michaeli",
                Email = "avirammichaeli@hotmail.com",
                ProfessionID = 6,
                Profession = context.Professions.Find(6),
                CityID = 15,
                City = context.Cities.Find(15),
                ProgramID = 2,
                Program = context.Programs.Find(2),
                Comments = "Totach"
            });

            context.Students.Add(new BE.Model.Student()
            {
                FirstName = "momi",
                LastName = "sultanov",
                Email = "sulti@hotmail.com",
                ProfessionID = 1,
                Profession = context.Professions.Find(1),
                CityID = 12,
                City = context.Cities.Find(12),
                ProgramID = 5,
                Program = context.Programs.Find(5),
                Comments = ""
            });

            context.Students.Add(new BE.Model.Student()
            {
                FirstName = "bijo",
                LastName = "shvily",
                Email = "roshgadol@hotmail.com",
                ProfessionID = 2,
                Profession = context.Professions.Find(2),
                CityID = 3,
                City = context.Cities.Find(3),
                ProgramID = 7,
                Program = context.Programs.Find(7),
                Comments = "gruzini"
            });
        }

        private void InitializeUsers(Jct_Dorms_DB context)
        {
            context.Users.Add(new BE.Model.User()
            {
                ID = 301081113,
                Email = "roee.sefi@gmail.com",
                FirstName = "Roee",
                LastName = "Sefi",
                Password = "123",
                Role = BE.Model.Role.Admin
            });

            context.Users.Add(new BE.Model.User()
            {
                ID = 327348769,
                Email = "r.n.lipkin@gmail.com‏",
                FirstName = "Raanan",
                LastName = "Lipkin",
                Password = "111",
                Role = BE.Model.Role.AvBait
            });

            context.Users.Add(new BE.Model.User()
            {
                ID = 037027315,
                Email = "reem1985@gmail.com‏",
                FirstName = "Reem",
                LastName = "Mouyal",
                Password = "770",
                Role = BE.Model.Role.AvBait
            });
        }
    }
}
